package com.monitor.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.monitor.entity.ErpTpmsTireInformationCar;
import com.monitor.service.ErpTpmsTireInformationCarService;
import com.monitor.util.Result;

import io.swagger.annotations.Api;

@RestController
@RequestMapping("/tireInformationCar")
@Api(description="手机版轮胎预警参数设置")
public class ErpTpmsTireInformationCarController {
	@Autowired
	private ErpTpmsTireInformationCarService erpTpmsTireInformationCarService;
	
	@RequestMapping("/selectByCarId")
	public Result<Map<String, Object>> selectByCarId(int carId){
		return erpTpmsTireInformationCarService.selectByCarId(carId);
	}
	
	@RequestMapping("/editCarformation")
	public Result<Boolean> editCarformation(@ModelAttribute ErpTpmsTireInformationCar car){
		try {
			Boolean count=erpTpmsTireInformationCarService.insertOrUpdate(car);
			return new Result<Boolean>(count, 1);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return new Result<>(1, e.getMessage());
		}
	}
}
